﻿using FigureDraw.Diagram;
using FigureDraw.Graphic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FigureDraw.Shapes.ActivityShape
{
    public class EndActivity : MyShape
    {
        public EndActivity()
            : base()
        {
            brushColor = new MyColorInfo(255, 255, 255);
        }

        public EndActivity(MyPoint startPoint, MyPoint endPoint)
            : base(startPoint, endPoint)
        {
            brushColor = new MyColorInfo(255, 255, 255);
        }

        public override void Draw(CommonGraphic graphic)
        {
            MyRectInfo rect = MyRectInfo.Convert(startPoint, endPoint);
            graphic.DrawEllipse(rect.Position, rect.Size, strokeColor, strokeWidth, brushColor);

            double smallCirW = 2 * rect.Size.X / 3;
            double smallCirH = 2 * rect.Size.Y / 3;
            double smallCirX = rect.Position.X + (rect.Size.X - smallCirW) / 2;
            double smallCirY = rect.Position.Y + (rect.Size.Y - smallCirH) / 2;

            graphic.DrawEllipse(new MyPoint(smallCirX, smallCirY), new MyPoint(smallCirW, smallCirH), strokeColor, strokeWidth, new MyColorInfo(0, 0, 0));
        }

        public override MyShape Clone(BlockDiagram diagram)
        {
            MyShape shape = diagram.DrawEnd(startPoint, endPoint);
            shape.StrokeColor = strokeColor;
            shape.StrokeWidth = strokeWidth;
            shape.BrushColor = brushColor;

            return shape;
        }

        public override MyShape Clone()
        {
            MyShape shape = new EndActivity(startPoint, endPoint);
            shape.StrokeColor = strokeColor;
            shape.StrokeWidth = strokeWidth;
            shape.BrushColor = brushColor;

            return shape;
        }
    }
}
